import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

export default defineConfig({
  plugins: [vue()],
  server: {
    allowedHosts: ['localhost','127.0.0.1','7d5b73e4.r18.vip.cpolar.cn'],
    proxy: {
      '/api': {
        target: 'http://localhost:8848', // 你的API服务器地址
        changeOrigin: true, // 允许跨域
        secure: false,      // 不校验 HTTPS
        rewrite: (path) => path.replace(/^\/api/, '')
      }
    }
  }
})
